<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="div1">我一个div</div>
    <script>
        /*
        var getId = document.getElementById;
        getId('div1');
        这时this被指向了window
        */
        document.getElementById = (function (func) {
            return function () {
                //this始终被指向document
                return func.apply(document,arguments);
            }
        })(document.getElementById);
        var getId = document.getElementById;
        var div1 = getId('div1');
        console.log(div1);
    </script>
</body>
</html>